<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style>
.editor table {
	display: inline;
	vertical-align: top;
}
</style>
<div class="r_location">
	<i class="r_txtico"></i> 内容管理&gt; 会员管理 &gt; 新建会员
</div>
<form id="add_form" action="cms/member/add" method="post">
	<ul class="all_list">
		<li>
			<span class="all_title">会员名称：</span>
			<span>
				<input class="ui_input" id="memberName" validator='{"label":"名称","isDigit":false,"minLength":1,"maxLength":50}'  name="memberName" style="width:100px;">
			</span>
		</li>
		<li>
			<span class="all_title">会员等级：</span>
			<span>
				<input class="ui_input" id="integral" validator='{"label":"会员等级","isDigit":true,"minLength":1,"maxLength":50}'  name="memberLevel" style="width:100px;">
			</span>
		</li>
		<li>
			<span class="all_title">会员积分：</span>
			<span>
				<input class="ui_input" id="memberLevel" validator='{"label":"会员积分","isDigit":true,"minLength":1,"maxLength":50}'  name="integral" style="width:100px;">
			</span>
		</li>
		<li>
			<span class="all_title">会员状态：</span>
			<span>
				<select id="stats" name="stats" class="ui_select">
					<option value="1" selected="selected">上架</option>
					<option value="2">下架</option>
				</select>
			</span>
		</li>
		<li class="editor"><span class="all_title">描述：</span> <span>
				<textarea id="content" name="remark"
					class="xheditor {tools:'FontSize,FontColor,Bold,Italic,Underline,Strikethrough,Fullscreen,Align,About',skin:'default',height:'300'}"
					rows="8" cols="80" style="width: 70%">
				</textarea> <span id="contentError"></span>
		</span></li>
		<li><span class="all_title"></span> <span> <input
				type="button" id="viewBtn" value="预览" onclick="preView()"
				class="btn_blue m-r15"> <input type="button"
				id="addBtn" value="提交" class="btn_blue m-r15 submitBtn">
		</span></li>
		
	</ul>
</form>
<script type="text/javascript">
    
	
	$(function() {
		$('#content').xheditor();
		$('#reset_button').click(function() {
			$('#content').val('');
		});
		$("#add_form").validator({}, {
			callback : function(data) {
				if (!$('#memberName').val()) {
					alert("会员名称不能为空");
					return false;
				} 
				if (!$('#memberLevel').val()) {
					alert("会员等级不能为空");
					return false;
				}
				if (!$('#integral').val()) {
					alert("积分不能为空");
					return false;
				}
				if (!$('#stats').val()) {
					alert("状态不能为空");
					return false;
				}
				if (!$('#content').val()) {
					$('#contentError').html('内容不能为空!').addClass('frame_error');
					return false;
				} else {
					$('#contentError').html('').removeClass('frame_error');
				}
				$("#add_form").ajaxSubmit(function(data) {
					if (data.success == 'succeed') {
						art.dialog({
							icon : data.success,
							content : data.message,
							lock : true
						}).time(1);
						to_page('/cms/member/view/page');
					} else {
						art.dialog({
							icon : data.success,
							content : data.message,
							lock : true
						});
					}
				});
			}
		});

	});
</script>